package org.jeecg.modules.friends.service.impl;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.modules.friends.dao.ReadyToDeleteDAO;
import org.jeecg.modules.friends.model.ReadyToDeleteDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReadyToDeleteServiceImpl implements org.jeecg.modules.friends.service.ReadyToDeleteService {
    @Autowired
    private ReadyToDeleteDAO readyToDeleteDAO;

    @Override
    public List<ReadyToDeleteDO> queryPastTimeRecords() {
        return readyToDeleteDAO.queryPastTimeRecords();
    }

    @Override
    public void updateFinishedBatch(List<ReadyToDeleteDO> deleteDOList) {
        if (CollectionUtils.isNotEmpty(deleteDOList)) {
            Set<Long> ids = deleteDOList.stream().map(ReadyToDeleteDO::getId).collect(Collectors.toSet());
            readyToDeleteDAO.updateFinishedBatch(ids);
        }
    }
}